using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class REDHireFormMap : EntityTypeConfiguration<REDHireForm>
    {
        public REDHireFormMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.OpenId)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Department)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("REDHireForm");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.OpenId).HasColumnName("OpenId");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Department).HasColumnName("Department");
            this.Property(t => t.OnboardDate).HasColumnName("OnboardDate");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
        }
    }
}
